package org.inasnet.user;

import org.inasnet.Root;

/**
 * Base class of user.
 */
public class User 
{
	public enum Status
	{
		OFFLINE,
		LEAVE,
		ONLINE,
	}
	
	User()
	{
		mStatus = Status.OFFLINE;
	}
	
	void setId( int id )
	{
		mId = id;
	}
	
	void setFullName( String fullName )
	{
		mFullName = fullName;
	}
	
	public String getFullName()
	{
		return mFullName;
	}
	
	public int getId()
	{
		return mId;
	}
	
	public Status getStatus() 
	{
		return mStatus;
	}

	public String getAddress() 
	{
		mAddress = UserConnector.getInetAddress( this );
		
		return mAddress;
	}
	
	public static String convertStatusToString( Status status ) 
	{
		return convertStatusToString( status.ordinal() );
	}
	
	public static String convertStatusToString( int status ) 
	{
		switch( Status.values()[ status ] )
		{
		case LEAVE:
			return Root.lang( "MAIN_Leave" );
			
		case OFFLINE:
			return Root.lang( "MAIN_Offline" );
			
		case ONLINE:
			return Root.lang( "MAIN_Online" );
		}
		
		return null;
	}
	
	public void setStatus( int status ) 
	{
		mStatus = Status.values()[ status ];
	}
	
	void setStatus( Status status ) 
	{
		mStatus = status;
	}
	
	int mId;
	
	String mFullName;
	
	String mNickName;
	
	String mAddress;
	
	Status mStatus;	
}
